package com.bootdo.api.domain;

public enum Status {
	SUCCESS(1), ERROR(0);
	
	private int value = 0;
	
	private Status(int value){	// 必须是private的，否则编译错误
		this.value = value;
	}
	
	public static Status valueOf(int value){	 // 手写的从int到enum的转换函数
		switch (value) {
		case 1:
			return SUCCESS;
		case 0:
			return ERROR;
		default:
			return ERROR;
		}
	}
	
	public int value() {
		return this.value;
	}
	
	public String toString(){
		return "" + value;
	}
}
